package com.pearl.jacksoncore.demo.databind.custom;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.pearl.jacksoncore.demo.pojo.Org;

import java.time.LocalDateTime;
import java.util.List;

/**
 *
 * @author TD
 * @version 1.0
 * @date 2024/4/11
 */
//@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class UserVO {
    Long id;
    String username;

    @JsonSerialize(using = ListToStringJsonSerializer.class)
    @JsonDeserialize(using = ListToStringJsonDeserializer.class)
    //@JsonListToCommaSplitString
    List<String> roleList;

    public void setRoleList(List<String> roleList) {
        this.roleList = roleList;
    }

    public List<String> getRoleList() {
        return roleList;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String toString() {
        return "UserVO{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", roleList=" + roleList +
                '}';
    }
}
